<template>
  <AppPage title="history" :back="false">
    <div class="history">
      <div class="container">
        <div class="chat-history">
          <div class="title">Chat History</div>

          <div class="history-list">
            <swiper
              :slides-per-view="1.75"
              :space-between="15"
              :initial-slide="0"
            >
              <swiper-slide class="swiper-slide" v-for="item in swiperList" :key="item.des">
                <div class="swiper-slide-inner">
                  <img src="@/assets/images/test.jpg" alt="" />

                  <div class="report">
                    <img src="@/assets/images/more.svg" alt="" />
                  </div>

                  <div class="user-info">
                    <div class="name">RunningJackalope8765</div>

                    <div class="country">
                      <div class="box">
                        <img src="@/assets/images/uk.svg" alt="" />

                        <span class="word">UK</span>
                      </div>

                      <div class="box">
                        <img src="@/assets/images/video_w.svg" alt="" />

                        <span class="word">33</span>
                      </div>
                    </div>

                    <div class="time">Yesterday 10:22 AM</div>
                  </div>

                  <div class="btn chat-btn">
                    <img src="@/assets/images/chat.svg" alt="" />

                    <span>Chat</span>
                  </div>
                </div>
              </swiper-slide>
            </swiper>
          </div>
        </div>

        <div class="all-history">
          <div class="title">All</div>

          <div class="sort-list">
            <div :class="['sort-item', gender.length ? 'active' : '']">
              <span class="word">性别</span>

              <img
                v-if="gender.length"
                src="@/assets/images/down-active.svg"
                alt=""
              />

              <img v-else src="@/assets/images/down.svg" alt="" />
            </div>

            <div :class="['sort-item', status.length ? 'active' : '']">
              <span class="word">狀態</span>

              <img
                v-if="status.length"
                src="@/assets/images/down-active.svg"
                alt=""
              />

              <img v-else src="@/assets/images/down.svg" alt="" />
            </div>

            <div :class="['sort-item', type.length ? 'active' : '']">
              <span class="word">类型</span>

              <img
                v-if="type.length"
                src="@/assets/images/down-active.svg"
                alt=""
              />

              <img v-else src="@/assets/images/down.svg" alt="" />
            </div>

            <!-- <div class="sort-item">

                        <span class="word">近期</span>

                        <img src="@/assets/images/down.svg" alt="" />

                        <img src="@/assets/images/down-active.svg" alt="" />

                    </div> -->
          </div>

          <div class="history-list">
            <div class="list-item">
              <div class="avatar">
                <img src="@/assets/images/avatar.svg" alt="" />
              </div>

              <div class="user-info">
                <div class="name">RunningJackalope8765</div>

                <div class="country">
                  <div class="box">
                    <img src="@/assets/images/uk.svg" alt="" />

                    <span class="word">UK</span>
                  </div>

                  <div class="box">
                    <img src="@/assets/images/video_w.svg" alt="" />

                    <span class="word">33</span>
                  </div>
                </div>

                <div class="time">Yesterday 10:22 AM</div>
              </div>

              <div class="handle">
                <div class="handle-item">
                  <img src="@/assets/images/chat.svg" alt="" />
                </div>

                <div class="handle-item">
                  <img src="@/assets/images/ic_report.svg" alt="" />
                </div>
              </div>
            </div>

            <div class="list-item">
              <div class="avatar">
                <img src="@/assets/images/avatar.svg" alt="" />
              </div>

              <div class="user-info">
                <div class="name">RunningJackalope8765</div>

                <div class="country">
                  <div class="box">
                    <img src="@/assets/images/uk.svg" alt="" />

                    <span class="word">UK</span>
                  </div>

                  <div class="box">
                    <img src="@/assets/images/video_w.svg" alt="" />

                    <span class="word">33</span>
                  </div>
                </div>

                <div class="time">Yesterday 10:22 AM</div>
              </div>

              <div class="handle">
                <div class="handle-item">
                  <img src="@/assets/images/chat.svg" alt="" />
                </div>

                <div class="handle-item">
                  <img src="@/assets/images/ic_report.svg" alt="" />
                </div>
              </div>
            </div>

            <div class="list-item">
              <div class="avatar">
                <img src="@/assets/images/avatar.svg" alt="" />
              </div>

              <div class="user-info">
                <div class="name">RunningJackalope8765</div>

                <div class="country">
                  <div class="box">
                    <img src="@/assets/images/uk.svg" alt="" />

                    <span class="word">UK</span>
                  </div>

                  <div class="box">
                    <img src="@/assets/images/video_w.svg" alt="" />

                    <span class="word">33</span>
                  </div>
                </div>

                <div class="time">Yesterday 10:22 AM</div>
              </div>

              <div class="handle">
                <div class="handle-item">
                  <img src="@/assets/images/chat.svg" alt="" />
                </div>

                <div class="handle-item">
                  <img src="@/assets/images/ic_report.svg" alt="" />
                </div>
              </div>
            </div>

            <div class="list-item">
              <div class="avatar">
                <img src="@/assets/images/avatar.svg" alt="" />
              </div>

              <div class="user-info">
                <div class="name">RunningJackalope8765</div>

                <div class="country">
                  <div class="box">
                    <img src="@/assets/images/uk.svg" alt="" />

                    <span class="word">UK</span>
                  </div>

                  <div class="box">
                    <img src="@/assets/images/video_w.svg" alt="" />

                    <span class="word">33</span>
                  </div>
                </div>

                <div class="time">Yesterday 10:22 AM</div>
              </div>

              <div class="handle">
                <div class="handle-item">
                  <img src="@/assets/images/chat.svg" alt="" />
                </div>

                <div class="handle-item">
                  <img src="@/assets/images/ic_report.svg" alt="" />
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- 未登录或者无记录 -->

      <div class="empty" v-if="false">
        <div class="empty-word">There is no history.</div>

        <div class="empty-word">Make a friend on the video chat.</div>

        <div class="start-btn">
          <img src="@/assets/images/video-fill.svg" alt="" />

          <span class="word">Start Video Chat</span>
        </div>
      </div>

      <div class="picker" v-if="showPick">
        <van-picker
          title="标题"
          v-model="gender"
          loading
          :columns="genderList"
        />
      </div>
    </div>
  </AppPage>
</template>

<script setup lang="ts">
import AppPage from "@/components/AppPage.vue";
import { Swiper, SwiperSlide } from "swiper/vue";
import "swiper/css";
import { reactive, ref } from "vue";
const showPick = ref(false);
const genderList = reactive([
  {
    text: "不限",
    value: 0,
  },
  {
    text: "男",
    value: 1,
  },
  {
    text: "女",
    value: 2,
  },
]);
const swiperList = reactive([
  {
    name: "test1",
    des: "TEST Sdas     fsdfasd fsdfas",
    country: "UK",
  },
  {
    name: "test2",
    des: "TEST Sdas  fqrERQWEWE   fsdfasd fsdfas",
    country: "USA",
  },
  {
    name: "test3",
    des: "TEST Sdas     fsdfasd fsdfas",
    country: "USA",
  },
  {
    name: "test4",
    des: "TEST Sdas     fsdfasd fsdfas",
    country: "USA",
  },
  {
    name: "test5",
    c: "TEST Sdas     fsdfasd fsdfas",
    country: "USA",
  },
]);
const gender = reactive([1]);
const status = reactive([1]);
const type = reactive([1]);
</script>

<style lang="less">
.history {
  height: 100vh;
  background-color: rgb(20, 20, 20);
  .container {
    overflow-y: auto;
    padding: 52px 0 66px 20px;
    background-color: rgb(20, 20, 20);
  }
  .chat-history {
    .title {
      color: #fff;
      text-align: left;
      font-weight: bold;
      line-height: 24px;
      padding: 24px 0;
    }
    .history-list {
      .swiper {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        padding-right: 15px;
      }
      .swiper-slide {
        width: 100%;
        height: 260px;
        display: flex;
        overflow: visible;
        position: relative;
        z-index: 1;
        .swiper-slide-inner {
          position: absolute;
          border-radius: 16px 16px;
          width: 100%;
          bottom: 0;
          left: 0;
          height: 260px;
          background-color: #fff;
          flex: 1;
          overflow: hidden;
          margin-bottom: 0;
          img {
            object-fit: cover;
          }
          .report {
            position: absolute;
            right: 15px;
            top: 10px;
            img {
              width: 24px;
              height: 24px;
            }
          }
          .user-info {
            width: 100%;
            padding: 10px 10px;
            position: absolute;
            bottom: 50px;
            left: 0;
          }
          .chat-btn {
            background: #fff;
            width: 80%;
            height: 40px;
            border-radius: 40px;
            line-height: 40px;
            font-weight: bold;
            position: absolute;
            left: 10%;
            bottom: 10px;
            display: flex;
            justify-content: center;
            color: #222222;
            img {
              width: 24px;
              height: 24px;
              margin-top: 7px;
              margin-right: 5px;
            }
          }
        }
      }
    }
  }
  .all-history {
    .title {
      color: #fff;
      text-align: left;
      font-weight: bold;
      line-height: 24px;
      padding: 24px 0;
    }
    .sort-list {
      display: flex;
      padding-right: 20px;
      margin-bottom: 24px;
      .sort-item {
        color: #aaaaaa;
        display: flex;
        border: 1px solid #aaa;
        line-height: 20px;
        border-radius: 25px;
        padding: 5px 15px;
        margin-right: 15px;
        .word {
          font-size: 12px;
          margin-right: 5px;
        }
        img {
          height: 20px;
          transition: all 0.2s linear;
        }
      }
      .sort-item:last-child {
        margin-right: 0;
      }
      .sort-item.active {
        border: 1px solid #00f69d;
        color: #00f69d;
      }
    }
    .history-list {
      .list-item {
        width: 100%;
        display: flex;
        margin-bottom: 35px;
        .avatar {
          display: flex;
          width: 64px;
          height: 64px;
          border-radius: 100%;
          background-color: #fff;
          margin-right: 10px;
          img {
            width: 64px;
            height: 64px;
            border-radius: 100%;
          }
        }
        .user-info {
          width: calc(100% - 220px);
        }
        .handle {
          display: flex;
          justify-content: flex-end;
          flex: 1;
          margin-top: 10px;
          padding-right: 5px;
          .handle-item {
            width: 44px;
            height: 44px;
            background-color: #fff;
            border-radius: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            margin-right: 15px;
            img {
              width: 24px;
              height: 24px;
              margin: 0 auto;
            }
          }
        }
      }
    }
  }

  .picker {
    width: 100%;
    position: fixed;
    bottom: 0;
    z-index: 10;
    --van-text-color: #fff;
    --van-picker-confirm-action-color: #00f69d;
    --van-picker-cancel-action-color: #fff;
    --van-picker-background: #333333;
    --van-picker-option-text-color: #ffffff;
    --van-picker-mask-color: linear-gradient(
        180deg,
        rgba(50, 50, 50, 0.8),
        rgba(50, 50, 50 0.2)
      ),
      linear-gradient(0deg, rgba(50, 50, 50, 0.8), rgba(50, 50, 50, 0.2));
  }
  .empty {
    height: 100vh;
    padding: 52px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    .empty-word {
      color: #fff;
      font-size: 20px;
      line-height: 30px;
      font-weight: bold;
    }
    .start-btn {
      background-color: #fff;
      border-radius: 50px;
      line-height: 50px;
      display: flex;
      justify-content: center;
      margin-top: 40px;
      img {
        width: 30px;
        height: 30px;
        margin-right: 10px;
        margin-top: 10px;
      }
      .word {
        color: #000;
        font-size: 16px;
        font-weight: bold;
      }
    }
  }
}

.user-info {
  text-align: left;
  .name {
    font-weight: bold;
    color: #fff;
    font-size: 12px;
    line-height: 17px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .country {
    display: flex;
    margin: 10px 0;
    .box {
      display: flex;
      line-height: 10px;
      margin-right: 5px;
      img {
        width: 12px;
        margin-right: 2px;
      }
      .word {
        color: #fff;
        font-size: 10px;
        font-weight: bold;
      }
    }
  }
  .time {
    color: #fff;
    font-size: 10px;
    line-height: 17px;
  }
}
</style>
